package zd.cornermemory.utils;

import zd.cornermemory.bean.Cube;

/**
 * Created by zhud on 2019/4/29.
 */

public class CodeUtil {

    public static String getCornerCode(int team) {
        Cube cube = new Cube();
        cube.init();
        int[][] cornerRanges;
        if (team == -2) {
            cornerRanges = new int[][]{{3,10},{0,3},{0,5}};
        }else{
            cornerRanges = new int[][]{{team*2,team*2},{0,3},{0,5}};
        }
        int[][] edgeRanges = {{0,6},{0,1},{0,1}};
        cube.cubeRandomStatus(cornerRanges,edgeRanges,0,0,0);
        String code = cube.readCorner()[0].toString();
        return code;
    }
    public static String getEdgeCode(int team) {
        Cube cube = new Cube();
        cube.init();
        int[][] cornerRanges = {{0,6},{0,1},{0,1}};
        int[][] edgeRanges;

        if (team == -2) {
            edgeRanges = new int[][]{{5,15},{0,3},{0,5}};
        }else{
            edgeRanges = new int[][]{{team*2,team*2},{0,3},{0,5}};
        }
        cube.cubeRandomStatus(cornerRanges,edgeRanges,0,0,0);
        String code = cube.readEdge()[0].toString();
        return code;
    }
}
